fix(security): block private/reserved IPs for hosted 1Password Connect SSRF#4818
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview On hosted, Logic is centralized in Reviewed by Cursor Bugbot for commit 243a06e. Configure here. |
Greptile SummaryThis PR strengthens the SSRF protection for 1Password Connect-mode routes by gating the IP validation policy on deployment type. The refactoring extracts a new
Confidence Score: 5/5Safe to merge. The change is narrowly scoped to the 1Password Connect URL validator, the logic correctly branches on The refactoring is clean and well-tested. All IP edge cases (loopback, RFC1918, link-local, IPv4-mapped IPv6) are covered, and the old DNS catch-block re-throw hack has been correctly eliminated. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[validateConnectServerUrl] --> B{hostname is IP literal?}
B -- Yes --> C[assertConnectIpAllowed\nip = literal]
B -- No --> D[dns.lookup hostname]
D -- error --> E[throw: hostname could not be resolved]
D -- success --> F[assertConnectIpAllowed\nip = resolved address]
C --> G{isHosted?}
F --> G
G -- true --> H{isPrivateOrReservedIP?}
H -- true --> I[throw: private or reserved IP address]
H -- false --> J[return IP for DNS pinning]
G -- false --> K{range === linkLocal?}
K -- true --> L[throw: link-local address]
K -- false --> J
Reviews (2): Last reviewed commit: "test(security): use real isPrivateOrRese..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 243a06e. Configure here.
Summary
validateConnectServerUrl: on hosted (isHosted), block all private/reserved IPs viaisPrivateOrReservedIP; on self-hosted, keep allowing private destinations (operator controls the network; Connect lives on RFC1918) and continue blocking link-local.Type of Change
Testing
bunx vitest run app/api/tools/onepassword/utils.test.ts— 15 passedbun run check:api-validation— passedChecklist